package com.whccb.apps.office.document.button;

import com.actionsoft.bpms.bo.engine.BO;
import com.actionsoft.bpms.bpmn.engine.core.delegate.ProcessExecutionContext;
import com.actionsoft.bpms.bpmn.engine.listener.ValueListener;
import com.actionsoft.bpms.commons.htmlframework.HtmlPageTemplate;
import com.actionsoft.sdk.local.SDK;
import com.whccb.apps.office.document.ODConstant;
import com.whccb.apps.office.document.util.ODAppUtil;

public class UseRedHeaderFileButtonDraft extends ValueListener {

	@Override
	public String execute(ProcessExecutionContext ctx) throws Exception {
		BO draftBo = SDK.getBOAPI().getByProcess("BO_WHBK_OD_DRAFT",
				ctx.getProcessInstance().getId());
		if (draftBo != null) {
			String recordTypeId = draftBo.getString("RECORDTYPEID");
			return HtmlPageTemplate.merge(ODConstant.APP_ID,
					"gw.hongt.template.html", ODAppUtil.getRedHeaderFileParam(
							ctx.getUserContext(), recordTypeId));
		}
		return null;
	}

}
